﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using FC.Model;


namespace FC.ViewModel.Test.TaskItemVMs
{
    public partial class TaskItemBatchVM : BaseBatchVM<TaskItem, TaskItem_BatchEdit>
    {
        public TaskItemBatchVM()
        {
            ListVM = new TaskItemListVM();
            LinkedVM = new TaskItem_BatchEdit();
        }

        public bool DoBatchUpdateIterationId()
        {
           var lastIter= DC.Set<Iteration>().LastOrDefault();
            if (lastIter==null)
            {
                ErrorMessage.Add("","没有最新的迭代");
                return false;
            }
            LinkedVM.IterationId = lastIter.ID;
            return base.DoBatchEdit();
        }
    }

	/// <summary>
    /// Class to define batch edit fields
    /// </summary>
    public class TaskItem_BatchEdit : BaseVM
    {
        [Display(Name = "标题")]
        public String Name { get; set; }
        [Display(Name = "任务描述")]
        public String Description { get; set; }
        public Guid? IterationId { get; set; }
        public Guid? FinishedUserId { get; set; }
        [Display(Name = "任务状态")]
        public TaskItemStatus? TaskStatus { get; set; }
        [Display(Name = "_Admin.Parent")]
        public Guid? ParentId { get; set; }

        protected override void InitVM()
        {
        }

    }

}
